package cn.flexui.flexuiserver.service.impl;

import cn.flexui.flexuiserver.domain.entity.SessionRecord;
import cn.flexui.flexuiserver.mapper.SessionRecordMapper;
import cn.flexui.flexuiserver.service.SessionRecordService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会话记录 服务实现类
 * </p>
 *
 * @author apeto
 * @since 2024-09-17 07:08:21
 */
@Service
public class SessionRecordServiceImpl extends ServiceImpl<SessionRecordMapper, SessionRecord> implements SessionRecordService {

    @Override
    public SessionRecord getByRequestId(String requestId) {

        return getOne(new LambdaQueryWrapper<SessionRecord>().eq(SessionRecord::getRequestId, requestId));
    }

    @Override
    public SessionRecord getByUidRequestId(Long userId, String requestId) {
        return getOne(new LambdaQueryWrapper<SessionRecord>().eq(SessionRecord::getUserId, userId).eq(SessionRecord::getRequestId, requestId));
    }
}
